<?php

/**
 * 
 */
class WidgetType extends CActiveRecord {
	
	public static function model($className=__CLASS__)
    {
        return parent::model($className);
    }
	
	public function tableName()
	{
		return '{{widgettype}}';
	}
	
	public function rules()
	{
		return array(
			array('widgetclass, name', 'required'),
			array('widgetclass, name, description', 'type', 'type'=>'string'),
			array('name', 'unique'),
		);
	}
	
	public function relations()
    {
        return array(
            'instances'=>array(self::HAS_MANY, 'WidgetInstance', 'type_id'),
        );
    }
}
